#include <iostream>
#include <string>
using namespace std;

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;
  for (cin >> T; T; T--) {
    int n;
    string s;
    long long cnt_u = 0, cnt_d = 0;
    cin >> n >> s;

    for (int i = 0; i < n; i++) {
      if (s[i] == '_') {
        cnt_d++;
      } else if (s[i] == '-') {
        cnt_u++;
      }
    }
    cout << cnt_d * (cnt_u >> 1) * (cnt_u - (cnt_u >> 1)) << "\n";
  }
  return 0;
}